import defaultState from '../state/img'
import methods from '../method/img'
import { fromJS } from 'immutable'


const reducer = (state = defaultState, action) => {
    let data = fromJS(action.data)      // 将传来的数据改为 list 对象
    try {
        return methods[action.type](state, data)
    } catch (error) {
        return state
    }
}

export default reducer